package com.wwinsoft.framework.entity.system;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.wwinsoft.framework.entity.IdVersionEntity;

@Entity
@Table(name = "T_CODE_TYPE")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class CodeType extends IdVersionEntity {
	
    // add by sevenSpend 2011-11-26 start -->
	/** 个人计划状态 */
    public static final String TYPE_PLAN_STATUS = "PLAN_STATUS";
	/** 部门类别 */
    public static final String TYPE_DEPT_CATEGORY = "DEPT_CATEGORY";
    // <-- add by sevenSpend 2011-11-26 end

    private String typeCode;

    private String shortDesc;

    private Boolean needMaintain;

    private Set<Code> codes = new HashSet<Code>();


    @OneToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY)
    @JoinColumn(name = "CODE_TYPE_ID")
    @OrderBy("id")
    @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
    public Set<Code> getCodes() {
        return codes;
    }

    public void setCodes(Set<Code> codes) {
        this.codes = codes;
    }

    public String getTypeCode() {
        return typeCode;
    }

    public void setTypeCode(String typeCode) {
        this.typeCode = typeCode;
    }

    public String getShortDesc() {
        return shortDesc;
    }

    public void setShortDesc(String shortDesc) {
        this.shortDesc = shortDesc;
    }

    public Boolean isNeedMaintain() {
        return needMaintain;
    }

    public void setNeedMaintain(Boolean needMaintain) {
        this.needMaintain = needMaintain;
    }
}